import {Component, Input, OnChanges, OnInit, SimpleChanges} from '@angular/core';
import { GetRTDataByKKSCodesService } from  '../../../../share/services/get-rtdata-by-kkscodes.service'

@Component({
  selector: 'app-group-level-summary',
  templateUrl: './group-level-summary.component.html',
  styleUrls: ['./group-level-summary.component.css']
})
export class GroupLevelSummaryComponent implements OnInit ,OnChanges{
  ngOnChanges(changes: SimpleChanges): void {
    if(changes['staticTime']){
      this.ngOnInit()
    }
  }


  constructor(
    private getData:GetRTDataByKKSCodesService
  ) { }

  @Input() staticTime:number
  @Input() id:number
  @Input() amount:number

  public res:any

  ngOnInit() {
    this.getData.getStdPowerById(this.id===0?1:this.id,this.staticTime)
      .subscribe(data=>{
        this.res=data;
        // this.setChart()
      })
  }

}
